﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using DBMigrator.Core.DBProviders;
using StructureMap;

namespace DBMigrator.Core.Execution
{
    public class MigrationExecutor : IMigrationExecutor
    {
        private readonly IDownMigrationExecutor downMigrationExecutor;
        private readonly IUpMigrationExecutor upMigrationExecutor;

        public MigrationExecutor(IDownMigrationExecutor downMigrationExecutor, IUpMigrationExecutor upMigrationExecutor)
        {
            this.downMigrationExecutor = downMigrationExecutor;
            this.upMigrationExecutor = upMigrationExecutor;
        }

        public void ExecuteMigrations(DateTime versionToMigrateTo)
        {
            downMigrationExecutor.ExecuteDownMigrations(versionToMigrateTo);
            upMigrationExecutor.ExecuteUpMigrations(versionToMigrateTo);
        }
    }
}
